{"ast":null,"code":"import _defineProperty from \"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/defineProperty.js\";\nimport _toArray from \"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/toArray.js\";\nimport _slicedToArray from \"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/slicedToArray.js\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport DownOutlined from \"@ant-design/icons/es/icons/DownOutlined\";\nimport { INTERNAL_COL_DEFINE } from 'rc-table';\nimport { arrAdd, arrDel } from \"rc-tree/es/util\";\nimport { conductCheck } from \"rc-tree/es/utils/conductUtil\";\nimport { convertDataToEntities } from \"rc-tree/es/utils/treeUtil\";\nimport useMergedState from \"rc-util/es/hooks/useMergedState\";\nimport * as React from 'react';\nimport { useCallback, useMemo, useState } from 'react';\nimport Checkbox from '../../checkbox';\nimport Dropdown from '../../dropdown';\nimport Radio from '../../radio';\nimport warning from '../../_util/warning';\n// TODO: warning if use ajax!!!\nexport var SELECTION_COLUMN = {};\nexport var SELECTION_ALL = 'SELECT_ALL';\nexport var SELECTION_INVERT = 'SELECT_INVERT';\nexport var SELECTION_NONE = 'SELECT_NONE';\nvar EMPTY_LIST = [];\nfunction flattenData(data, childrenColumnName) {\n  var list = [];\n  (data || []).forEach(function (record) {\n    list.push(record);\n    if (record && typeof record === 'object' && childrenColumnName in record) {\n      list = [].concat(_toConsumableArray(list), _toConsumableArray(flattenData(record[childrenColumnName], childrenColumnName)));\n    }\n  });\n  return list;\n}\nexport default function useSelection(rowSelection, config) {\n  var _ref5 = rowSelection || {},\n    preserveSelectedRowKeys = _ref5.preserveSelectedRowKeys,\n    selectedRowKeys = _ref5.selectedRowKeys,\n    defaultSelectedRowKeys = _ref5.defaultSelectedRowKeys,\n    getCheckboxProps = _ref5.getCheckboxProps,\n    onSelectionChange = _ref5.onChange,\n    onSelect = _ref5.onSelect,\n    onSelectAll = _ref5.onSelectAll,\n    onSelectInvert = _ref5.onSelectInvert,\n    onSelectNone = _ref5.onSelectNone,\n    onSelectMultiple = _ref5.onSelectMultiple,\n    selectionColWidth = _ref5.columnWidth,\n    selectionType = _ref5.type,\n    selections = _ref5.selections,\n    fixed = _ref5.fixed,\n    customizeRenderCell = _ref5.renderCell,\n    hideSelectAll = _ref5.hideSelectAll,\n    _ref5$checkStrictly = _ref5.checkStrictly,\n    checkStrictly = _ref5$checkStrictly === void 0 ? true : _ref5$checkStrictly;\n  var prefixCls = config.prefixCls,\n    data = config.data,\n    pageData = config.pageData,\n    getRecordByKey = config.getRecordByKey,\n    getRowKey = config.getRowKey,\n    expandType = config.expandType,\n    childrenColumnName = config.childrenColumnName,\n    tableLocale = config.locale,\n    getPopupContainer = config.getPopupContainer;\n  // ========================= Keys =========================\n  var _useMergedState = useMergedState(selectedRowKeys || defaultSelectedRowKeys || EMPTY_LIST, {\n      value: selectedRowKeys\n    }),\n    _useMergedState2 = _slicedToArray(_useMergedState, 2),\n    mergedSelectedKeys = _useMergedState2[0],\n    setMergedSelectedKeys = _useMergedState2[1];\n  // ======================== Caches ========================\n  var preserveRecordsRef = React.useRef(new Map());\n  var updatePreserveRecordsCache = useCallback(function (keys) {\n    if (preserveSelectedRowKeys) {\n      var newCache = new Map();\n      // Keep key if mark as preserveSelectedRowKeys\n      keys.forEach(function (key) {\n        var record = getRecordByKey(key);\n        if (!record && preserveRecordsRef.current.has(key)) {\n          record = preserveRecordsRef.current.get(key);\n        }\n        newCache.set(key, record);\n      });\n      // Refresh to new cache\n      preserveRecordsRef.current = newCache;\n    }\n  }, [getRecordByKey, preserveSelectedRowKeys]);\n  // Update cache with selectedKeys\n  React.useEffect(function () {\n    updatePreserveRecordsCache(mergedSelectedKeys);\n  }, [mergedSelectedKeys]);\n  var _useMemo = useMemo(function () {\n      return checkStrictly ? {\n        keyEntities: null\n      } : convertDataToEntities(data, {\n        externalGetKey: getRowKey,\n        childrenPropName: childrenColumnName\n      });\n    }, [data, getRowKey, checkStrictly, childrenColumnName]),\n    keyEntities = _useMemo.keyEntities;\n  // Get flatten data\n  var flattedData = useMemo(function () {\n    return flattenData(pageData, childrenColumnName);\n  }, [pageData, childrenColumnName]);\n  // Get all checkbox props\n  var checkboxPropsMap = useMemo(function () {\n    var map = new Map();\n    flattedData.forEach(function (record, index) {\n      var key = getRowKey(record, index);\n      var checkboxProps = (getCheckboxProps ? getCheckboxProps(record) : null) || {};\n      map.set(key, checkboxProps);\n      process.env.NODE_ENV !== \"production\" ? warning(!('checked' in checkboxProps || 'defaultChecked' in checkboxProps), 'Table', 'Do not set `checked` or `defaultChecked` in `getCheckboxProps`. Please use `selectedRowKeys` instead.') : void 0;\n    });\n    return map;\n  }, [flattedData, getRowKey, getCheckboxProps]);\n  var isCheckboxDisabled = useCallback(function (r) {\n    var _a;\n    return !!((_a = checkboxPropsMap.get(getRowKey(r))) === null || _a === void 0 ? void 0 : _a.disabled);\n  }, [checkboxPropsMap, getRowKey]);\n  var _useMemo2 = useMemo(function () {\n      if (checkStrictly) {\n        return [mergedSelectedKeys || [], []];\n      }\n      var _conductCheck = conductCheck(mergedSelectedKeys, true, keyEntities, isCheckboxDisabled),\n        checkedKeys = _conductCheck.checkedKeys,\n        halfCheckedKeys = _conductCheck.halfCheckedKeys;\n      return [checkedKeys || [], halfCheckedKeys];\n    }, [mergedSelectedKeys, checkStrictly, keyEntities, isCheckboxDisabled]),\n    _useMemo3 = _slicedToArray(_useMemo2, 2),\n    derivedSelectedKeys = _useMemo3[0],\n    derivedHalfSelectedKeys = _useMemo3[1];\n  var derivedSelectedKeySet = useMemo(function () {\n    var keys = selectionType === 'radio' ? derivedSelectedKeys.slice(0, 1) : derivedSelectedKeys;\n    return new Set(keys);\n  }, [derivedSelectedKeys, selectionType]);\n  var derivedHalfSelectedKeySet = useMemo(function () {\n    return selectionType === 'radio' ? new Set() : new Set(derivedHalfSelectedKeys);\n  }, [derivedHalfSelectedKeys, selectionType]);\n  // Save last selected key to enable range selection\n  var _useState = useState(null),\n    _useState2 = _slicedToArray(_useState, 2),\n    lastSelectedKey = _useState2[0],\n    setLastSelectedKey = _useState2[1];\n  // Reset if rowSelection reset\n  React.useEffect(function () {\n    if (!rowSelection) {\n      setMergedSelectedKeys(EMPTY_LIST);\n    }\n  }, [!!rowSelection]);\n  var setSelectedKeys = useCallback(function (keys, method) {\n    var availableKeys;\n    var records;\n    updatePreserveRecordsCache(keys);\n    if (preserveSelectedRowKeys) {\n      availableKeys = keys;\n      records = keys.map(function (key) {\n        return preserveRecordsRef.current.get(key);\n      });\n    } else {\n      // Filter key which not exist in the `dataSource`\n      availableKeys = [];\n      records = [];\n      keys.forEach(function (key) {\n        var record = getRecordByKey(key);\n        if (record !== undefined) {\n          availableKeys.push(key);\n          records.push(record);\n        }\n      });\n    }\n    setMergedSelectedKeys(availableKeys);\n    onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange(availableKeys, records, {\n      type: method\n    });\n  }, [setMergedSelectedKeys, getRecordByKey, onSelectionChange, preserveSelectedRowKeys]);\n  // ====================== Selections ======================\n  // Trigger single `onSelect` event\n  var triggerSingleSelection = useCallback(function (key, selected, keys, event) {\n    if (onSelect) {\n      var rows = keys.map(function (k) {\n        return getRecordByKey(k);\n      });\n      onSelect(getRecordByKey(key), selected, rows, event);\n    }\n    setSelectedKeys(keys, 'single');\n  }, [onSelect, getRecordByKey, setSelectedKeys]);\n  var mergedSelections = useMemo(function () {\n    if (!selections || hideSelectAll) {\n      return null;\n    }\n    var selectionList = selections === true ? [SELECTION_ALL, SELECTION_INVERT, SELECTION_NONE] : selections;\n    return selectionList.map(function (selection) {\n      if (selection === SELECTION_ALL) {\n        return {\n          key: 'all',\n          text: tableLocale.selectionAll,\n          onSelect: function onSelect() {\n            setSelectedKeys(data.map(function (record, index) {\n              return getRowKey(record, index);\n            }).filter(function (key) {\n              var checkProps = checkboxPropsMap.get(key);\n              return !(checkProps === null || checkProps === void 0 ? void 0 : checkProps.disabled) || derivedSelectedKeySet.has(key);\n            }), 'all');\n          }\n        };\n      }\n      if (selection === SELECTION_INVERT) {\n        return {\n          key: 'invert',\n          text: tableLocale.selectInvert,\n          onSelect: function onSelect() {\n            var keySet = new Set(derivedSelectedKeySet);\n            pageData.forEach(function (record, index) {\n              var key = getRowKey(record, index);\n              var checkProps = checkboxPropsMap.get(key);\n              if (!(checkProps === null || checkProps === void 0 ? void 0 : checkProps.disabled)) {\n                if (keySet.has(key)) {\n                  keySet.delete(key);\n                } else {\n                  keySet.add(key);\n                }\n              }\n            });\n            var keys = Array.from(keySet);\n            if (onSelectInvert) {\n              process.env.NODE_ENV !== \"production\" ? warning(false, 'Table', '`onSelectInvert` will be removed in future. Please use `onChange` instead.') : void 0;\n              onSelectInvert(keys);\n            }\n            setSelectedKeys(keys, 'invert');\n          }\n        };\n      }\n      if (selection === SELECTION_NONE) {\n        return {\n          key: 'none',\n          text: tableLocale.selectNone,\n          onSelect: function onSelect() {\n            onSelectNone === null || onSelectNone === void 0 ? void 0 : onSelectNone();\n            setSelectedKeys(Array.from(derivedSelectedKeySet).filter(function (key) {\n              var checkProps = checkboxPropsMap.get(key);\n              return checkProps === null || checkProps === void 0 ? void 0 : checkProps.disabled;\n            }), 'none');\n          }\n        };\n      }\n      return selection;\n    }).map(function (selection) {\n      return Object.assign(Object.assign({}, selection), {\n        onSelect: function onSelect() {\n          var _a2;\n          var _a;\n          for (var _len = arguments.length, rest = new Array(_len), _key = 0; _key < _len; _key++) {\n            rest[_key] = arguments[_key];\n          }\n          (_a = selection.onSelect) === null || _a === void 0 ? void 0 : (_a2 = _a).call.apply(_a2, [selection].concat(rest));\n          setLastSelectedKey(null);\n        }\n      });\n    });\n  }, [selections, derivedSelectedKeySet, pageData, getRowKey, onSelectInvert, setSelectedKeys]);\n  // ======================= Columns ========================\n  var transformColumns = useCallback(function (columns) {\n    var _a;\n    // >>>>>>>>>>> Skip if not exists `rowSelection`\n    if (!rowSelection) {\n      process.env.NODE_ENV !== \"production\" ? warning(!columns.includes(SELECTION_COLUMN), 'Table', '`rowSelection` is not config but `SELECTION_COLUMN` exists in the `columns`.') : void 0;\n      return columns.filter(function (col) {\n        return col !== SELECTION_COLUMN;\n      });\n    }\n    // >>>>>>>>>>> Support selection\n    var cloneColumns = _toConsumableArray(columns);\n    var keySet = new Set(derivedSelectedKeySet);\n    // Record key only need check with enabled\n    var recordKeys = flattedData.map(getRowKey).filter(function (key) {\n      return !checkboxPropsMap.get(key).disabled;\n    });\n    var checkedCurrentAll = recordKeys.every(function (key) {\n      return keySet.has(key);\n    });\n    var checkedCurrentSome = recordKeys.some(function (key) {\n      return keySet.has(key);\n    });\n    var onSelectAllChange = function onSelectAllChange() {\n      var changeKeys = [];\n      if (checkedCurrentAll) {\n        recordKeys.forEach(function (key) {\n          keySet.delete(key);\n          changeKeys.push(key);\n        });\n      } else {\n        recordKeys.forEach(function (key) {\n          if (!keySet.has(key)) {\n            keySet.add(key);\n            changeKeys.push(key);\n          }\n        });\n      }\n      var keys = Array.from(keySet);\n      onSelectAll === null || onSelectAll === void 0 ? void 0 : onSelectAll(!checkedCurrentAll, keys.map(function (k) {\n        return getRecordByKey(k);\n      }), changeKeys.map(function (k) {\n        return getRecordByKey(k);\n      }));\n      setSelectedKeys(keys, 'all');\n      setLastSelectedKey(null);\n    };\n    // ===================== Render =====================\n    // Title Cell\n    var title;\n    if (selectionType !== 'radio') {\n      var customizeSelections;\n      if (mergedSelections) {\n        var menu = {\n          getPopupContainer: getPopupContainer,\n          items: mergedSelections.map(function (selection, index) {\n            var key = selection.key,\n              text = selection.text,\n              onSelectionClick = selection.onSelect;\n            return {\n              key: key || index,\n              onClick: function onClick() {\n                onSelectionClick === null || onSelectionClick === void 0 ? void 0 : onSelectionClick(recordKeys);\n              },\n              label: text\n            };\n          })\n        };\n        customizeSelections = /*#__PURE__*/React.createElement(\"div\", {\n          className: \"\".concat(prefixCls, \"-selection-extra\")\n        }, /*#__PURE__*/React.createElement(Dropdown, {\n          menu: menu,\n          getPopupContainer: getPopupContainer\n        }, /*#__PURE__*/React.createElement(\"span\", null, /*#__PURE__*/React.createElement(DownOutlined, null))));\n      }\n      var allDisabledData = flattedData.map(function (record, index) {\n        var key = getRowKey(record, index);\n        var checkboxProps = checkboxPropsMap.get(key) || {};\n        return Object.assign({\n          checked: keySet.has(key)\n        }, checkboxProps);\n      }).filter(function (_ref) {\n        var disabled = _ref.disabled;\n        return disabled;\n      });\n      var allDisabled = !!allDisabledData.length && allDisabledData.length === flattedData.length;\n      var allDisabledAndChecked = allDisabled && allDisabledData.every(function (_ref2) {\n        var checked = _ref2.checked;\n        return checked;\n      });\n      var allDisabledSomeChecked = allDisabled && allDisabledData.some(function (_ref3) {\n        var checked = _ref3.checked;\n        return checked;\n      });\n      title = !hideSelectAll && /*#__PURE__*/React.createElement(\"div\", {\n        className: \"\".concat(prefixCls, \"-selection\")\n      }, /*#__PURE__*/React.createElement(Checkbox, {\n        checked: !allDisabled ? !!flattedData.length && checkedCurrentAll : allDisabledAndChecked,\n        indeterminate: !allDisabled ? !checkedCurrentAll && checkedCurrentSome : !allDisabledAndChecked && allDisabledSomeChecked,\n        onChange: onSelectAllChange,\n        disabled: flattedData.length === 0 || allDisabled,\n        \"aria-label\": customizeSelections ? 'Custom selection' : 'Select all',\n        skipGroup: true\n      }), customizeSelections);\n    }\n    // Body Cell\n    var renderCell;\n    if (selectionType === 'radio') {\n      renderCell = function renderCell(_, record, index) {\n        var key = getRowKey(record, index);\n        var checked = keySet.has(key);\n        return {\n          node: /*#__PURE__*/React.createElement(Radio, Object.assign({}, checkboxPropsMap.get(key), {\n            checked: checked,\n            onClick: function onClick(e) {\n              return e.stopPropagation();\n            },\n            onChange: function onChange(event) {\n              if (!keySet.has(key)) {\n                triggerSingleSelection(key, true, [key], event.nativeEvent);\n              }\n            }\n          })),\n          checked: checked\n        };\n      };\n    } else {\n      renderCell = function renderCell(_, record, index) {\n        var _a;\n        var key = getRowKey(record, index);\n        var checked = keySet.has(key);\n        var indeterminate = derivedHalfSelectedKeySet.has(key);\n        var checkboxProps = checkboxPropsMap.get(key);\n        var mergedIndeterminate;\n        if (expandType === 'nest') {\n          mergedIndeterminate = indeterminate;\n          process.env.NODE_ENV !== \"production\" ? warning(typeof (checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.indeterminate) !== 'boolean', 'Table', 'set `indeterminate` using `rowSelection.getCheckboxProps` is not allowed with tree structured dataSource.') : void 0;\n        } else {\n          mergedIndeterminate = (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.indeterminate) !== null && _a !== void 0 ? _a : indeterminate;\n        }\n        // Record checked\n        return {\n          node: /*#__PURE__*/React.createElement(Checkbox, Object.assign({}, checkboxProps, {\n            indeterminate: mergedIndeterminate,\n            checked: checked,\n            skipGroup: true,\n            onClick: function onClick(e) {\n              return e.stopPropagation();\n            },\n            onChange: function onChange(_ref4) {\n              var nativeEvent = _ref4.nativeEvent;\n              var shiftKey = nativeEvent.shiftKey;\n              var startIndex = -1;\n              var endIndex = -1;\n              // Get range of this\n              if (shiftKey && checkStrictly) {\n                var pointKeys = new Set([lastSelectedKey, key]);\n                recordKeys.some(function (recordKey, recordIndex) {\n                  if (pointKeys.has(recordKey)) {\n                    if (startIndex === -1) {\n                      startIndex = recordIndex;\n                    } else {\n                      endIndex = recordIndex;\n                      return true;\n                    }\n                  }\n                  return false;\n                });\n              }\n              if (endIndex !== -1 && startIndex !== endIndex && checkStrictly) {\n                // Batch update selections\n                var rangeKeys = recordKeys.slice(startIndex, endIndex + 1);\n                var changedKeys = [];\n                if (checked) {\n                  rangeKeys.forEach(function (recordKey) {\n                    if (keySet.has(recordKey)) {\n                      changedKeys.push(recordKey);\n                      keySet.delete(recordKey);\n                    }\n                  });\n                } else {\n                  rangeKeys.forEach(function (recordKey) {\n                    if (!keySet.has(recordKey)) {\n                      changedKeys.push(recordKey);\n                      keySet.add(recordKey);\n                    }\n                  });\n                }\n                var keys = Array.from(keySet);\n                onSelectMultiple === null || onSelectMultiple === void 0 ? void 0 : onSelectMultiple(!checked, keys.map(function (recordKey) {\n                  return getRecordByKey(recordKey);\n                }), changedKeys.map(function (recordKey) {\n                  return getRecordByKey(recordKey);\n                }));\n                setSelectedKeys(keys, 'multiple');\n              } else {\n                // Single record selected\n                var originCheckedKeys = derivedSelectedKeys;\n                if (checkStrictly) {\n                  var checkedKeys = checked ? arrDel(originCheckedKeys, key) : arrAdd(originCheckedKeys, key);\n                  triggerSingleSelection(key, !checked, checkedKeys, nativeEvent);\n                } else {\n                  // Always fill first\n                  var result = conductCheck([].concat(_toConsumableArray(originCheckedKeys), [key]), true, keyEntities, isCheckboxDisabled);\n                  var _checkedKeys = result.checkedKeys,\n                    halfCheckedKeys = result.halfCheckedKeys;\n                  var nextCheckedKeys = _checkedKeys;\n                  // If remove, we do it again to correction\n                  if (checked) {\n                    var tempKeySet = new Set(_checkedKeys);\n                    tempKeySet.delete(key);\n                    nextCheckedKeys = conductCheck(Array.from(tempKeySet), {\n                      checked: false,\n                      halfCheckedKeys: halfCheckedKeys\n                    }, keyEntities, isCheckboxDisabled).checkedKeys;\n                  }\n                  triggerSingleSelection(key, !checked, nextCheckedKeys, nativeEvent);\n                }\n              }\n              if (checked) {\n                setLastSelectedKey(null);\n              } else {\n                setLastSelectedKey(key);\n              }\n            }\n          })),\n          checked: checked\n        };\n      };\n    }\n    var renderSelectionCell = function renderSelectionCell(_, record, index) {\n      var _renderCell = renderCell(_, record, index),\n        node = _renderCell.node,\n        checked = _renderCell.checked;\n      if (customizeRenderCell) {\n        return customizeRenderCell(checked, record, index, node);\n      }\n      return node;\n    };\n    // Insert selection column if not exist\n    if (!cloneColumns.includes(SELECTION_COLUMN)) {\n      // Always after expand icon\n      if (cloneColumns.findIndex(function (col) {\n        var _a;\n        return ((_a = col[INTERNAL_COL_DEFINE]) === null || _a === void 0 ? void 0 : _a.columnType) === 'EXPAND_COLUMN';\n      }) === 0) {\n        var _cloneColumns = cloneColumns,\n          _cloneColumns2 = _toArray(_cloneColumns),\n          expandColumn = _cloneColumns2[0],\n          restColumns = _cloneColumns2.slice(1);\n        cloneColumns = [expandColumn, SELECTION_COLUMN].concat(_toConsumableArray(restColumns));\n      } else {\n        // Normal insert at first column\n        cloneColumns = [SELECTION_COLUMN].concat(_toConsumableArray(cloneColumns));\n      }\n    }\n    // Deduplicate selection column\n    var selectionColumnIndex = cloneColumns.indexOf(SELECTION_COLUMN);\n    process.env.NODE_ENV !== \"production\" ? warning(cloneColumns.filter(function (col) {\n      return col === SELECTION_COLUMN;\n    }).length <= 1, 'Table', 'Multiple `SELECTION_COLUMN` exist in `columns`.') : void 0;\n    cloneColumns = cloneColumns.filter(function (column, index) {\n      return column !== SELECTION_COLUMN || index === selectionColumnIndex;\n    });\n    // Fixed column logic\n    var prevCol = cloneColumns[selectionColumnIndex - 1];\n    var nextCol = cloneColumns[selectionColumnIndex + 1];\n    var mergedFixed = fixed;\n    if (mergedFixed === undefined) {\n      if ((nextCol === null || nextCol === void 0 ? void 0 : nextCol.fixed) !== undefined) {\n        mergedFixed = nextCol.fixed;\n      } else if ((prevCol === null || prevCol === void 0 ? void 0 : prevCol.fixed) !== undefined) {\n        mergedFixed = prevCol.fixed;\n      }\n    }\n    if (mergedFixed && prevCol && ((_a = prevCol[INTERNAL_COL_DEFINE]) === null || _a === void 0 ? void 0 : _a.columnType) === 'EXPAND_COLUMN' && prevCol.fixed === undefined) {\n      prevCol.fixed = mergedFixed;\n    }\n    // Replace with real selection column\n    var selectionColumn = _defineProperty({\n      fixed: mergedFixed,\n      width: selectionColWidth,\n      className: \"\".concat(prefixCls, \"-selection-column\"),\n      title: rowSelection.columnTitle || title,\n      render: renderSelectionCell\n    }, INTERNAL_COL_DEFINE, {\n      className: \"\".concat(prefixCls, \"-selection-col\")\n    });\n    return cloneColumns.map(function (col) {\n      return col === SELECTION_COLUMN ? selectionColumn : col;\n    });\n  }, [getRowKey, flattedData, rowSelection, derivedSelectedKeys, derivedSelectedKeySet, derivedHalfSelectedKeySet, selectionColWidth, mergedSelections, expandType, lastSelectedKey, checkboxPropsMap, onSelectMultiple, triggerSingleSelection, isCheckboxDisabled]);\n  return [transformColumns, derivedSelectedKeySet];\n}","map":{"version":3,"names":["_toConsumableArray","DownOutlined","INTERNAL_COL_DEFINE","arrAdd","arrDel","conductCheck","convertDataToEntities","useMergedState","React","useCallback","useMemo","useState","Checkbox","Dropdown","Radio","warning","SELECTION_COLUMN","SELECTION_ALL","SELECTION_INVERT","SELECTION_NONE","EMPTY_LIST","flattenData","data","childrenColumnName","list","forEach","record","push","concat","useSelection","rowSelection","config","preserveSelectedRowKeys","selectedRowKeys","defaultSelectedRowKeys","getCheckboxProps","onSelectionChange","onChange","onSelect","onSelectAll","onSelectInvert","onSelectNone","onSelectMultiple","selectionColWidth","columnWidth","selectionType","type","selections","fixed","customizeRenderCell","renderCell","hideSelectAll","checkStrictly","prefixCls","pageData","getRecordByKey","getRowKey","expandType","tableLocale","locale","getPopupContainer","value","mergedSelectedKeys","setMergedSelectedKeys","preserveRecordsRef","useRef","Map","updatePreserveRecordsCache","keys","newCache","key","current","has","get","set","useEffect","keyEntities","externalGetKey","childrenPropName","flattedData","checkboxPropsMap","map","index","checkboxProps","process","env","NODE_ENV","isCheckboxDisabled","r","_a","disabled","checkedKeys","halfCheckedKeys","derivedSelectedKeys","derivedHalfSelectedKeys","derivedSelectedKeySet","slice","Set","derivedHalfSelectedKeySet","lastSelectedKey","setLastSelectedKey","setSelectedKeys","method","availableKeys","records","undefined","triggerSingleSelection","selected","event","rows","k","mergedSelections","selectionList","selection","text","selectionAll","filter","checkProps","selectInvert","keySet","delete","add","Array","from","selectNone","Object","assign","_a2","_len","arguments","length","rest","_key","call","apply","transformColumns","columns","includes","col","cloneColumns","recordKeys","checkedCurrentAll","every","checkedCurrentSome","some","onSelectAllChange","changeKeys","title","customizeSelections","menu","items","onSelectionClick","onClick","label","createElement","className","allDisabledData","checked","_ref","allDisabled","allDisabledAndChecked","_ref2","allDisabledSomeChecked","_ref3","indeterminate","skipGroup","_","node","e","stopPropagation","nativeEvent","mergedIndeterminate","_ref4","shiftKey","startIndex","endIndex","pointKeys","recordKey","recordIndex","rangeKeys","changedKeys","originCheckedKeys","result","nextCheckedKeys","tempKeySet","renderSelectionCell","findIndex","columnType","expandColumn","restColumns","selectionColumnIndex","indexOf","column","prevCol","nextCol","mergedFixed","selectionColumn","width","columnTitle","render"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/antd/es/table/hooks/useSelection.js"],"sourcesContent":["import _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport DownOutlined from \"@ant-design/icons/es/icons/DownOutlined\";\nimport { INTERNAL_COL_DEFINE } from 'rc-table';\nimport { arrAdd, arrDel } from \"rc-tree/es/util\";\nimport { conductCheck } from \"rc-tree/es/utils/conductUtil\";\nimport { convertDataToEntities } from \"rc-tree/es/utils/treeUtil\";\nimport useMergedState from \"rc-util/es/hooks/useMergedState\";\nimport * as React from 'react';\nimport { useCallback, useMemo, useState } from 'react';\nimport Checkbox from '../../checkbox';\nimport Dropdown from '../../dropdown';\nimport Radio from '../../radio';\nimport warning from '../../_util/warning';\n// TODO: warning if use ajax!!!\nexport const SELECTION_COLUMN = {};\nexport const SELECTION_ALL = 'SELECT_ALL';\nexport const SELECTION_INVERT = 'SELECT_INVERT';\nexport const SELECTION_NONE = 'SELECT_NONE';\nconst EMPTY_LIST = [];\nfunction flattenData(data, childrenColumnName) {\n  let list = [];\n  (data || []).forEach(record => {\n    list.push(record);\n    if (record && typeof record === 'object' && childrenColumnName in record) {\n      list = [].concat(_toConsumableArray(list), _toConsumableArray(flattenData(record[childrenColumnName], childrenColumnName)));\n    }\n  });\n  return list;\n}\nexport default function useSelection(rowSelection, config) {\n  const {\n    preserveSelectedRowKeys,\n    selectedRowKeys,\n    defaultSelectedRowKeys,\n    getCheckboxProps,\n    onChange: onSelectionChange,\n    onSelect,\n    onSelectAll,\n    onSelectInvert,\n    onSelectNone,\n    onSelectMultiple,\n    columnWidth: selectionColWidth,\n    type: selectionType,\n    selections,\n    fixed,\n    renderCell: customizeRenderCell,\n    hideSelectAll,\n    checkStrictly = true\n  } = rowSelection || {};\n  const {\n    prefixCls,\n    data,\n    pageData,\n    getRecordByKey,\n    getRowKey,\n    expandType,\n    childrenColumnName,\n    locale: tableLocale,\n    getPopupContainer\n  } = config;\n  // ========================= Keys =========================\n  const [mergedSelectedKeys, setMergedSelectedKeys] = useMergedState(selectedRowKeys || defaultSelectedRowKeys || EMPTY_LIST, {\n    value: selectedRowKeys\n  });\n  // ======================== Caches ========================\n  const preserveRecordsRef = React.useRef(new Map());\n  const updatePreserveRecordsCache = useCallback(keys => {\n    if (preserveSelectedRowKeys) {\n      const newCache = new Map();\n      // Keep key if mark as preserveSelectedRowKeys\n      keys.forEach(key => {\n        let record = getRecordByKey(key);\n        if (!record && preserveRecordsRef.current.has(key)) {\n          record = preserveRecordsRef.current.get(key);\n        }\n        newCache.set(key, record);\n      });\n      // Refresh to new cache\n      preserveRecordsRef.current = newCache;\n    }\n  }, [getRecordByKey, preserveSelectedRowKeys]);\n  // Update cache with selectedKeys\n  React.useEffect(() => {\n    updatePreserveRecordsCache(mergedSelectedKeys);\n  }, [mergedSelectedKeys]);\n  const {\n    keyEntities\n  } = useMemo(() => checkStrictly ? {\n    keyEntities: null\n  } : convertDataToEntities(data, {\n    externalGetKey: getRowKey,\n    childrenPropName: childrenColumnName\n  }), [data, getRowKey, checkStrictly, childrenColumnName]);\n  // Get flatten data\n  const flattedData = useMemo(() => flattenData(pageData, childrenColumnName), [pageData, childrenColumnName]);\n  // Get all checkbox props\n  const checkboxPropsMap = useMemo(() => {\n    const map = new Map();\n    flattedData.forEach((record, index) => {\n      const key = getRowKey(record, index);\n      const checkboxProps = (getCheckboxProps ? getCheckboxProps(record) : null) || {};\n      map.set(key, checkboxProps);\n      process.env.NODE_ENV !== \"production\" ? warning(!('checked' in checkboxProps || 'defaultChecked' in checkboxProps), 'Table', 'Do not set `checked` or `defaultChecked` in `getCheckboxProps`. Please use `selectedRowKeys` instead.') : void 0;\n    });\n    return map;\n  }, [flattedData, getRowKey, getCheckboxProps]);\n  const isCheckboxDisabled = useCallback(r => {\n    var _a;\n    return !!((_a = checkboxPropsMap.get(getRowKey(r))) === null || _a === void 0 ? void 0 : _a.disabled);\n  }, [checkboxPropsMap, getRowKey]);\n  const [derivedSelectedKeys, derivedHalfSelectedKeys] = useMemo(() => {\n    if (checkStrictly) {\n      return [mergedSelectedKeys || [], []];\n    }\n    const {\n      checkedKeys,\n      halfCheckedKeys\n    } = conductCheck(mergedSelectedKeys, true, keyEntities, isCheckboxDisabled);\n    return [checkedKeys || [], halfCheckedKeys];\n  }, [mergedSelectedKeys, checkStrictly, keyEntities, isCheckboxDisabled]);\n  const derivedSelectedKeySet = useMemo(() => {\n    const keys = selectionType === 'radio' ? derivedSelectedKeys.slice(0, 1) : derivedSelectedKeys;\n    return new Set(keys);\n  }, [derivedSelectedKeys, selectionType]);\n  const derivedHalfSelectedKeySet = useMemo(() => selectionType === 'radio' ? new Set() : new Set(derivedHalfSelectedKeys), [derivedHalfSelectedKeys, selectionType]);\n  // Save last selected key to enable range selection\n  const [lastSelectedKey, setLastSelectedKey] = useState(null);\n  // Reset if rowSelection reset\n  React.useEffect(() => {\n    if (!rowSelection) {\n      setMergedSelectedKeys(EMPTY_LIST);\n    }\n  }, [!!rowSelection]);\n  const setSelectedKeys = useCallback((keys, method) => {\n    let availableKeys;\n    let records;\n    updatePreserveRecordsCache(keys);\n    if (preserveSelectedRowKeys) {\n      availableKeys = keys;\n      records = keys.map(key => preserveRecordsRef.current.get(key));\n    } else {\n      // Filter key which not exist in the `dataSource`\n      availableKeys = [];\n      records = [];\n      keys.forEach(key => {\n        const record = getRecordByKey(key);\n        if (record !== undefined) {\n          availableKeys.push(key);\n          records.push(record);\n        }\n      });\n    }\n    setMergedSelectedKeys(availableKeys);\n    onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange(availableKeys, records, {\n      type: method\n    });\n  }, [setMergedSelectedKeys, getRecordByKey, onSelectionChange, preserveSelectedRowKeys]);\n  // ====================== Selections ======================\n  // Trigger single `onSelect` event\n  const triggerSingleSelection = useCallback((key, selected, keys, event) => {\n    if (onSelect) {\n      const rows = keys.map(k => getRecordByKey(k));\n      onSelect(getRecordByKey(key), selected, rows, event);\n    }\n    setSelectedKeys(keys, 'single');\n  }, [onSelect, getRecordByKey, setSelectedKeys]);\n  const mergedSelections = useMemo(() => {\n    if (!selections || hideSelectAll) {\n      return null;\n    }\n    const selectionList = selections === true ? [SELECTION_ALL, SELECTION_INVERT, SELECTION_NONE] : selections;\n    return selectionList.map(selection => {\n      if (selection === SELECTION_ALL) {\n        return {\n          key: 'all',\n          text: tableLocale.selectionAll,\n          onSelect() {\n            setSelectedKeys(data.map((record, index) => getRowKey(record, index)).filter(key => {\n              const checkProps = checkboxPropsMap.get(key);\n              return !(checkProps === null || checkProps === void 0 ? void 0 : checkProps.disabled) || derivedSelectedKeySet.has(key);\n            }), 'all');\n          }\n        };\n      }\n      if (selection === SELECTION_INVERT) {\n        return {\n          key: 'invert',\n          text: tableLocale.selectInvert,\n          onSelect() {\n            const keySet = new Set(derivedSelectedKeySet);\n            pageData.forEach((record, index) => {\n              const key = getRowKey(record, index);\n              const checkProps = checkboxPropsMap.get(key);\n              if (!(checkProps === null || checkProps === void 0 ? void 0 : checkProps.disabled)) {\n                if (keySet.has(key)) {\n                  keySet.delete(key);\n                } else {\n                  keySet.add(key);\n                }\n              }\n            });\n            const keys = Array.from(keySet);\n            if (onSelectInvert) {\n              process.env.NODE_ENV !== \"production\" ? warning(false, 'Table', '`onSelectInvert` will be removed in future. Please use `onChange` instead.') : void 0;\n              onSelectInvert(keys);\n            }\n            setSelectedKeys(keys, 'invert');\n          }\n        };\n      }\n      if (selection === SELECTION_NONE) {\n        return {\n          key: 'none',\n          text: tableLocale.selectNone,\n          onSelect() {\n            onSelectNone === null || onSelectNone === void 0 ? void 0 : onSelectNone();\n            setSelectedKeys(Array.from(derivedSelectedKeySet).filter(key => {\n              const checkProps = checkboxPropsMap.get(key);\n              return checkProps === null || checkProps === void 0 ? void 0 : checkProps.disabled;\n            }), 'none');\n          }\n        };\n      }\n      return selection;\n    }).map(selection => Object.assign(Object.assign({}, selection), {\n      onSelect: function () {\n        var _a2;\n        var _a;\n        for (var _len = arguments.length, rest = new Array(_len), _key = 0; _key < _len; _key++) {\n          rest[_key] = arguments[_key];\n        }\n        (_a = selection.onSelect) === null || _a === void 0 ? void 0 : (_a2 = _a).call.apply(_a2, [selection].concat(rest));\n        setLastSelectedKey(null);\n      }\n    }));\n  }, [selections, derivedSelectedKeySet, pageData, getRowKey, onSelectInvert, setSelectedKeys]);\n  // ======================= Columns ========================\n  const transformColumns = useCallback(columns => {\n    var _a;\n    // >>>>>>>>>>> Skip if not exists `rowSelection`\n    if (!rowSelection) {\n      process.env.NODE_ENV !== \"production\" ? warning(!columns.includes(SELECTION_COLUMN), 'Table', '`rowSelection` is not config but `SELECTION_COLUMN` exists in the `columns`.') : void 0;\n      return columns.filter(col => col !== SELECTION_COLUMN);\n    }\n    // >>>>>>>>>>> Support selection\n    let cloneColumns = _toConsumableArray(columns);\n    const keySet = new Set(derivedSelectedKeySet);\n    // Record key only need check with enabled\n    const recordKeys = flattedData.map(getRowKey).filter(key => !checkboxPropsMap.get(key).disabled);\n    const checkedCurrentAll = recordKeys.every(key => keySet.has(key));\n    const checkedCurrentSome = recordKeys.some(key => keySet.has(key));\n    const onSelectAllChange = () => {\n      const changeKeys = [];\n      if (checkedCurrentAll) {\n        recordKeys.forEach(key => {\n          keySet.delete(key);\n          changeKeys.push(key);\n        });\n      } else {\n        recordKeys.forEach(key => {\n          if (!keySet.has(key)) {\n            keySet.add(key);\n            changeKeys.push(key);\n          }\n        });\n      }\n      const keys = Array.from(keySet);\n      onSelectAll === null || onSelectAll === void 0 ? void 0 : onSelectAll(!checkedCurrentAll, keys.map(k => getRecordByKey(k)), changeKeys.map(k => getRecordByKey(k)));\n      setSelectedKeys(keys, 'all');\n      setLastSelectedKey(null);\n    };\n    // ===================== Render =====================\n    // Title Cell\n    let title;\n    if (selectionType !== 'radio') {\n      let customizeSelections;\n      if (mergedSelections) {\n        const menu = {\n          getPopupContainer,\n          items: mergedSelections.map((selection, index) => {\n            const {\n              key,\n              text,\n              onSelect: onSelectionClick\n            } = selection;\n            return {\n              key: key || index,\n              onClick: () => {\n                onSelectionClick === null || onSelectionClick === void 0 ? void 0 : onSelectionClick(recordKeys);\n              },\n              label: text\n            };\n          })\n        };\n        customizeSelections = /*#__PURE__*/React.createElement(\"div\", {\n          className: `${prefixCls}-selection-extra`\n        }, /*#__PURE__*/React.createElement(Dropdown, {\n          menu: menu,\n          getPopupContainer: getPopupContainer\n        }, /*#__PURE__*/React.createElement(\"span\", null, /*#__PURE__*/React.createElement(DownOutlined, null))));\n      }\n      const allDisabledData = flattedData.map((record, index) => {\n        const key = getRowKey(record, index);\n        const checkboxProps = checkboxPropsMap.get(key) || {};\n        return Object.assign({\n          checked: keySet.has(key)\n        }, checkboxProps);\n      }).filter(_ref => {\n        let {\n          disabled\n        } = _ref;\n        return disabled;\n      });\n      const allDisabled = !!allDisabledData.length && allDisabledData.length === flattedData.length;\n      const allDisabledAndChecked = allDisabled && allDisabledData.every(_ref2 => {\n        let {\n          checked\n        } = _ref2;\n        return checked;\n      });\n      const allDisabledSomeChecked = allDisabled && allDisabledData.some(_ref3 => {\n        let {\n          checked\n        } = _ref3;\n        return checked;\n      });\n      title = !hideSelectAll && /*#__PURE__*/React.createElement(\"div\", {\n        className: `${prefixCls}-selection`\n      }, /*#__PURE__*/React.createElement(Checkbox, {\n        checked: !allDisabled ? !!flattedData.length && checkedCurrentAll : allDisabledAndChecked,\n        indeterminate: !allDisabled ? !checkedCurrentAll && checkedCurrentSome : !allDisabledAndChecked && allDisabledSomeChecked,\n        onChange: onSelectAllChange,\n        disabled: flattedData.length === 0 || allDisabled,\n        \"aria-label\": customizeSelections ? 'Custom selection' : 'Select all',\n        skipGroup: true\n      }), customizeSelections);\n    }\n    // Body Cell\n    let renderCell;\n    if (selectionType === 'radio') {\n      renderCell = (_, record, index) => {\n        const key = getRowKey(record, index);\n        const checked = keySet.has(key);\n        return {\n          node: /*#__PURE__*/React.createElement(Radio, Object.assign({}, checkboxPropsMap.get(key), {\n            checked: checked,\n            onClick: e => e.stopPropagation(),\n            onChange: event => {\n              if (!keySet.has(key)) {\n                triggerSingleSelection(key, true, [key], event.nativeEvent);\n              }\n            }\n          })),\n          checked\n        };\n      };\n    } else {\n      renderCell = (_, record, index) => {\n        var _a;\n        const key = getRowKey(record, index);\n        const checked = keySet.has(key);\n        const indeterminate = derivedHalfSelectedKeySet.has(key);\n        const checkboxProps = checkboxPropsMap.get(key);\n        let mergedIndeterminate;\n        if (expandType === 'nest') {\n          mergedIndeterminate = indeterminate;\n          process.env.NODE_ENV !== \"production\" ? warning(typeof (checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.indeterminate) !== 'boolean', 'Table', 'set `indeterminate` using `rowSelection.getCheckboxProps` is not allowed with tree structured dataSource.') : void 0;\n        } else {\n          mergedIndeterminate = (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.indeterminate) !== null && _a !== void 0 ? _a : indeterminate;\n        }\n        // Record checked\n        return {\n          node: /*#__PURE__*/React.createElement(Checkbox, Object.assign({}, checkboxProps, {\n            indeterminate: mergedIndeterminate,\n            checked: checked,\n            skipGroup: true,\n            onClick: e => e.stopPropagation(),\n            onChange: _ref4 => {\n              let {\n                nativeEvent\n              } = _ref4;\n              const {\n                shiftKey\n              } = nativeEvent;\n              let startIndex = -1;\n              let endIndex = -1;\n              // Get range of this\n              if (shiftKey && checkStrictly) {\n                const pointKeys = new Set([lastSelectedKey, key]);\n                recordKeys.some((recordKey, recordIndex) => {\n                  if (pointKeys.has(recordKey)) {\n                    if (startIndex === -1) {\n                      startIndex = recordIndex;\n                    } else {\n                      endIndex = recordIndex;\n                      return true;\n                    }\n                  }\n                  return false;\n                });\n              }\n              if (endIndex !== -1 && startIndex !== endIndex && checkStrictly) {\n                // Batch update selections\n                const rangeKeys = recordKeys.slice(startIndex, endIndex + 1);\n                const changedKeys = [];\n                if (checked) {\n                  rangeKeys.forEach(recordKey => {\n                    if (keySet.has(recordKey)) {\n                      changedKeys.push(recordKey);\n                      keySet.delete(recordKey);\n                    }\n                  });\n                } else {\n                  rangeKeys.forEach(recordKey => {\n                    if (!keySet.has(recordKey)) {\n                      changedKeys.push(recordKey);\n                      keySet.add(recordKey);\n                    }\n                  });\n                }\n                const keys = Array.from(keySet);\n                onSelectMultiple === null || onSelectMultiple === void 0 ? void 0 : onSelectMultiple(!checked, keys.map(recordKey => getRecordByKey(recordKey)), changedKeys.map(recordKey => getRecordByKey(recordKey)));\n                setSelectedKeys(keys, 'multiple');\n              } else {\n                // Single record selected\n                const originCheckedKeys = derivedSelectedKeys;\n                if (checkStrictly) {\n                  const checkedKeys = checked ? arrDel(originCheckedKeys, key) : arrAdd(originCheckedKeys, key);\n                  triggerSingleSelection(key, !checked, checkedKeys, nativeEvent);\n                } else {\n                  // Always fill first\n                  const result = conductCheck([].concat(_toConsumableArray(originCheckedKeys), [key]), true, keyEntities, isCheckboxDisabled);\n                  const {\n                    checkedKeys,\n                    halfCheckedKeys\n                  } = result;\n                  let nextCheckedKeys = checkedKeys;\n                  // If remove, we do it again to correction\n                  if (checked) {\n                    const tempKeySet = new Set(checkedKeys);\n                    tempKeySet.delete(key);\n                    nextCheckedKeys = conductCheck(Array.from(tempKeySet), {\n                      checked: false,\n                      halfCheckedKeys\n                    }, keyEntities, isCheckboxDisabled).checkedKeys;\n                  }\n                  triggerSingleSelection(key, !checked, nextCheckedKeys, nativeEvent);\n                }\n              }\n              if (checked) {\n                setLastSelectedKey(null);\n              } else {\n                setLastSelectedKey(key);\n              }\n            }\n          })),\n          checked\n        };\n      };\n    }\n    const renderSelectionCell = (_, record, index) => {\n      const {\n        node,\n        checked\n      } = renderCell(_, record, index);\n      if (customizeRenderCell) {\n        return customizeRenderCell(checked, record, index, node);\n      }\n      return node;\n    };\n    // Insert selection column if not exist\n    if (!cloneColumns.includes(SELECTION_COLUMN)) {\n      // Always after expand icon\n      if (cloneColumns.findIndex(col => {\n        var _a;\n        return ((_a = col[INTERNAL_COL_DEFINE]) === null || _a === void 0 ? void 0 : _a.columnType) === 'EXPAND_COLUMN';\n      }) === 0) {\n        const [expandColumn, ...restColumns] = cloneColumns;\n        cloneColumns = [expandColumn, SELECTION_COLUMN].concat(_toConsumableArray(restColumns));\n      } else {\n        // Normal insert at first column\n        cloneColumns = [SELECTION_COLUMN].concat(_toConsumableArray(cloneColumns));\n      }\n    }\n    // Deduplicate selection column\n    const selectionColumnIndex = cloneColumns.indexOf(SELECTION_COLUMN);\n    process.env.NODE_ENV !== \"production\" ? warning(cloneColumns.filter(col => col === SELECTION_COLUMN).length <= 1, 'Table', 'Multiple `SELECTION_COLUMN` exist in `columns`.') : void 0;\n    cloneColumns = cloneColumns.filter((column, index) => column !== SELECTION_COLUMN || index === selectionColumnIndex);\n    // Fixed column logic\n    const prevCol = cloneColumns[selectionColumnIndex - 1];\n    const nextCol = cloneColumns[selectionColumnIndex + 1];\n    let mergedFixed = fixed;\n    if (mergedFixed === undefined) {\n      if ((nextCol === null || nextCol === void 0 ? void 0 : nextCol.fixed) !== undefined) {\n        mergedFixed = nextCol.fixed;\n      } else if ((prevCol === null || prevCol === void 0 ? void 0 : prevCol.fixed) !== undefined) {\n        mergedFixed = prevCol.fixed;\n      }\n    }\n    if (mergedFixed && prevCol && ((_a = prevCol[INTERNAL_COL_DEFINE]) === null || _a === void 0 ? void 0 : _a.columnType) === 'EXPAND_COLUMN' && prevCol.fixed === undefined) {\n      prevCol.fixed = mergedFixed;\n    }\n    // Replace with real selection column\n    const selectionColumn = {\n      fixed: mergedFixed,\n      width: selectionColWidth,\n      className: `${prefixCls}-selection-column`,\n      title: rowSelection.columnTitle || title,\n      render: renderSelectionCell,\n      [INTERNAL_COL_DEFINE]: {\n        className: `${prefixCls}-selection-col`\n      }\n    };\n    return cloneColumns.map(col => col === SELECTION_COLUMN ? selectionColumn : col);\n  }, [getRowKey, flattedData, rowSelection, derivedSelectedKeys, derivedSelectedKeySet, derivedHalfSelectedKeySet, selectionColWidth, mergedSelections, expandType, lastSelectedKey, checkboxPropsMap, onSelectMultiple, triggerSingleSelection, isCheckboxDisabled]);\n  return [transformColumns, derivedSelectedKeySet];\n}"],"mappings":";;;AAAA,OAAOA,kBAAkB,MAAM,8CAA8C;AAC7E,OAAOC,YAAY,MAAM,yCAAyC;AAClE,SAASC,mBAAmB,QAAQ,UAAU;AAC9C,SAASC,MAAM,EAAEC,MAAM,QAAQ,iBAAiB;AAChD,SAASC,YAAY,QAAQ,8BAA8B;AAC3D,SAASC,qBAAqB,QAAQ,2BAA2B;AACjE,OAAOC,cAAc,MAAM,iCAAiC;AAC5D,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AACtD,OAAOC,QAAQ,MAAM,gBAAgB;AACrC,OAAOC,QAAQ,MAAM,gBAAgB;AACrC,OAAOC,KAAK,MAAM,aAAa;AAC/B,OAAOC,OAAO,MAAM,qBAAqB;AACzC;AACA,OAAO,IAAMC,gBAAgB,GAAG,CAAC,CAAC;AAClC,OAAO,IAAMC,aAAa,GAAG,YAAY;AACzC,OAAO,IAAMC,gBAAgB,GAAG,eAAe;AAC/C,OAAO,IAAMC,cAAc,GAAG,aAAa;AAC3C,IAAMC,UAAU,GAAG,EAAE;AACrB,SAASC,WAAW,CAACC,IAAI,EAAEC,kBAAkB,EAAE;EAC7C,IAAIC,IAAI,GAAG,EAAE;EACb,CAACF,IAAI,IAAI,EAAE,EAAEG,OAAO,CAAC,UAAAC,MAAM,EAAI;IAC7BF,IAAI,CAACG,IAAI,CAACD,MAAM,CAAC;IACjB,IAAIA,MAAM,IAAI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